home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -screenplay- / hd_installers / -whdload- / whdload_dev / src / whdloadgci / wincpu.c < prev    next >
C/C++ Source or Header  |  2000-02-28  |  9KB  |  213 lines

  1. /*****************************************************************************
  2. ;  :Module.        wincpu.c
  3. ;  :Author.        Bert Jahn
  4. ;  :EMail.        jah@fh-zwickau.de
  5. ;  :Address.    Franz-Liszt-Straße 16, Rudolstadt, 07404, Germany
  6. ;  :Version.    $Id: wincpu.c 0.1 1998/08/06 23:13:50 jah Exp $
  7. ;  :History.    18.07.98 started
  8. ;  :Copyright.    All Rights Reserved
  9. ;  :Language.    C
  10. ;  :Tabsize.    4
  11. ;  :Translator.    SAS 6.58
  12. ****************************************************************************/
  13.  
  14. #include <exec/execbase.h>
  15.  
  16. #include <clib/alib_protos.h>
  17. #include <clib/muimaster_protos.h>
  18.  
  19. #include <pragmas/muimaster_pragmas.h>
  20.  
  21. #include "whddump.h"
  22. #include "WHDLoadGCI.h"
  23.  
  24. /****************************************************************************/
  25.  
  26. extern APTR                        app,win;
  27. extern APTR                        regmsp,regcacr,regpcr,regbuscr;
  28. extern struct whddump_header    *header;
  29. extern struct whddump_cpu        *cpu;
  30. extern struct NewMenu            MenuData1[];
  31. extern const char                *StringHexAccept;
  32. extern struct Library            *MUIMasterBase;
  33.  
  34. /****************************************************************************/
  35.  
  36. APTR win_cpu = NULL;
  37.  
  38. /****************************************************************************/
  39.  
  40. void make_win_cpu(void) {
  41.     ULONG open;
  42.     APTR strip_cpu;
  43.     APTR
  44.         regsfc=0,regdfc=0,regvbr=0,regcaar=0,regtt0=0,regtt1=0,regdtt0=0,regdtt1=0,
  45.         regitt0=0,regitt1=0,regcrp=0,regsrp=0,regurp=0,regtc=0,regmmusr=0;
  46.     const char
  47.         sfc[]="SFC:",dfc[]="DFC:",vbr[]="VBR:",msp[]="MSP:",caar[]="CAAR:",cacr[]="CACR:",tc[]="TC:",crp[]="CRP:",srp[]="SRP:",
  48.         urp[]="URP:",mmusr[]="MMUSR:",tt0[]="TT0:",tt1[]="TT1:",dtt0[]="DTT0:",dtt1[]="DTT1:",itt0[]="ITT0:",itt1[]="ITT1:";
  49.     static const char t_morecpu[]="More CPU";
  50.  
  51.     if (win_cpu) {
  52.         get(win_cpu,MUIA_Window_Open,&open);
  53.         if (open)    set(win_cpu,MUIA_Window_Open,FALSE);
  54.         else        set(win_cpu,MUIA_Window_Open,TRUE);
  55.     } else {
  56.         switch ((header->wdh_CPU)&(AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060)) {
  57.         case 0:
  58.             win_cpu = WindowObject,
  59.                 MUIA_Window_Title, t_morecpu,
  60.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  61.                 MUIA_Window_Menustrip, strip_cpu = MUI_MakeObject(MUIO_MenustripNM,MenuData1,0),
  62.                 WindowContents,
  63.                     TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68000", End,
  64.                 End;
  65.             break;
  66.         case AFF_68010:
  67.             win_cpu = WindowObject,
  68.                 MUIA_Window_Title, t_morecpu,
  69.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  70.                 MUIA_Window_Menustrip, strip_cpu = MUI_MakeObject(MUIO_MenustripNM,MenuData1,0),
  71.                 WindowContents, VGroup,
  72.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68010", End,
  73.                     Child, HGroup, MUIA_Group_Columns, 2,
  74.                         Child, Label2(sfc),        Child, regsfc = TextObject, StringFrame, End,
  75.                         Child, Label2(dfc),        Child, regdfc = TextObject, StringFrame, End,
  76.                         Child, Label2(vbr),        Child, regvbr = TextObject, StringFrame, End,
  77.                         End,
  78.                     End,
  79.                 End;
  80.             break;
  81.         case AFF_68010|AFF_68020:
  82.             win_cpu = WindowObject,
  83.                 MUIA_Window_Title, t_morecpu,
  84.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  85.                 MUIA_Window_Menustrip, strip_cpu = MUI_MakeObject(MUIO_MenustripNM,MenuData1,0),
  86.                 WindowContents, VGroup,
  87.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68020", End,
  88.                     Child, HGroup, MUIA_Group_Columns, 2,
  89.                         Child, Label2(sfc),        Child, regsfc = TextObject, StringFrame, End,
  90.                         Child, Label2(dfc),        Child, regdfc = TextObject, StringFrame, End,
  91.                         Child, Label2(vbr),        Child, regvbr = TextObject, StringFrame, End,
  92.                         Child, Label2(msp),        Child, regmsp = StringHex8,
  93.                         Child, Label2(cacr),    Child, regcacr = StringHex8,
  94.                         Child, Label2(cacr),    Child, regcacr = TextObject, StringFrame, End,
  95.                         End,
  96.                     End,
  97.                 End;
  98.             break;
  99.         case AFF_68010|AFF_68020|AFF_68030:
  100.             win_cpu = WindowObject,
  101.                 MUIA_Window_Title, t_morecpu,
  102.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  103.                 MUIA_Window_Menustrip, strip_cpu = MUI_MakeObject(MUIO_MenustripNM,MenuData1,0),
  104.                 WindowContents, VGroup,
  105.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68030", End,
  106.                     Child, HGroup, MUIA_Group_Columns, 2,
  107.                         Child, Label2(sfc),        Child, regsfc = TextObject, StringFrame, End,
  108.                         Child, Label2(dfc),        Child, regdfc = TextObject, StringFrame, End,
  109.                         Child, Label2(vbr),        Child, regvbr = TextObject, StringFrame, End,
  110.                         Child, Label2(msp),        Child, regmsp = StringHex8,
  111.                         Child, Label2(caar),    Child, regcaar = TextObject, StringFrame, End,
  112.                         Child, Label2(cacr),    Child, regcacr = StringHex8,
  113.                         Child, Label2(tc),        Child, regtc = TextObject, StringFrame, End,
  114.                         Child, Label2(crp),        Child, regcrp = TextObject, StringFrame, End,
  115.                         Child, Label2(srp),        Child, regsrp = TextObject, StringFrame, End,
  116.                         Child, Label2(mmusr),    Child, regmmusr = TextObject, StringFrame, End,
  117.                         Child, Label2(tt0),        Child, regtt0 = TextObject, StringFrame, End,
  118.                         Child, Label2(tt1),        Child, regtt1 = TextObject, StringFrame, End,
  119.                         End,
  120.                     End,
  121.                 End;
  122.             break;
  123.         case AFF_68010|AFF_68020|AFF_68030|AFF_68040:
  124.             win_cpu = WindowObject,
  125.                 MUIA_Window_Title, t_morecpu,
  126.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  127.                 MUIA_Window_Menustrip, strip_cpu = MUI_MakeObject(MUIO_MenustripNM,MenuData1,0),
  128.                 WindowContents, VGroup,
  129.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68040", End,
  130.                     Child, HGroup, MUIA_Group_Columns, 2,
  131.                         Child, Label2(sfc),        Child, regsfc = TextObject, StringFrame, End,
  132.                         Child, Label2(dfc),        Child, regdfc = TextObject, StringFrame, End,
  133.                         Child, Label2(vbr),        Child, regvbr = TextObject, StringFrame, End,
  134.                         Child, Label2(msp),        Child, regmsp = StringHex8,
  135.                         Child, Label2(cacr),    Child, regcacr = StringHex8,
  136.                         Child, Label2(tc),        Child, regtc = TextObject, StringFrame, End,
  137.                         Child, Label2(srp),        Child, regsrp = TextObject, StringFrame, End,
  138.                         Child, Label2(urp),        Child, regurp = TextObject, StringFrame, End,
  139.                         Child, Label2(mmusr),    Child, regmmusr = TextObject, StringFrame, End,
  140.                         Child, Label2(dtt0),    Child, regdtt0 = TextObject, StringFrame, End,
  141.                         Child, Label2(dtt1),    Child, regdtt1 = TextObject, StringFrame, End,
  142.                         Child, Label2(itt0),    Child, regitt0 = TextObject, StringFrame, End,
  143.                         Child, Label2(itt1),    Child, regitt1 = TextObject, StringFrame, End,
  144.                         End,
  145.                     End,
  146.                 End;
  147.             break;
  148.         case AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060:
  149.             win_cpu = WindowObject,
  150.                 MUIA_Window_Title, t_morecpu,
  151.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  152.                 MUIA_Window_Menustrip, strip_cpu = MUI_MakeObject(MUIO_MenustripNM,MenuData1,0),
  153.                 WindowContents, VGroup,
  154.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68060", End,
  155.                     Child, HGroup, MUIA_Group_Columns, 2,
  156.                         Child, Label2(sfc),        Child, regsfc = TextObject, StringFrame, MUIA_ShortHelp, "Source Function Code", End,
  157.                         Child, Label2(dfc),        Child, regdfc = TextObject, StringFrame, End,
  158.                         Child, Label2(vbr),        Child, regvbr = TextObject, StringFrame, End,
  159.                         Child, Label2(cacr),    Child, regcacr = StringHex8,
  160.                         Child, Label2("PCR:"),    Child, regpcr = StringHex8,
  161.                         Child, Label2("BUSCR:"),Child, regbuscr = StringHex8,
  162.                         Child, Label2(tc),        Child, regtc = TextObject, StringFrame, End,
  163.                         Child, Label2(srp),        Child, regsrp = TextObject, StringFrame, End,
  164.                         Child, Label2(urp),        Child, regurp = TextObject, StringFrame, End,
  165.                         Child, Label2(dtt0),    Child, regdtt0 = TextObject, StringFrame, End,
  166.                         Child, Label2(dtt1),    Child, regdtt1 = TextObject, StringFrame, End,
  167.                         Child, Label2(itt0),    Child, regitt0 = TextObject, StringFrame, End,
  168.                         Child, Label2(itt1),    Child, regitt1 = TextObject, StringFrame, End,
  169.                         End,
  170.                     End,
  171.                 End;
  172.             break;
  173.         }
  174.         if (win_cpu) {
  175.             DoMethod(app,OM_ADDMEMBER,win_cpu);
  176.             if (regsfc) sethex1t(regsfc,cpu->wdc_sfc);
  177.             if (regdfc) sethex1t(regdfc,cpu->wdc_dfc);
  178.             if (regvbr) sethex8t(regvbr,cpu->wdc_vbr);
  179.             if (regmsp) sethex8(regmsp,cpu->wdc_msp);
  180.             if (regcaar) sethex8(regcaar,cpu->wdc_caar);
  181.             if (regcacr) sethex8(regcacr,cpu->wdc_cacr);
  182.             if (regpcr) sethex8(regpcr,cpu->wdc_pcr);
  183.             if (regbuscr) sethex8(regbuscr,cpu->wdc_buscr);
  184.             if (regtc) sethex8t(regtc,cpu->wdc_tc);
  185.             if (regcrp) sethex16t(regcrp,cpu->wdc_crp[0],cpu->wdc_crp[1]);
  186.             switch ((header->wdh_CPU)&(AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060)) {
  187.             case AFF_68010|AFF_68020|AFF_68030:
  188.                 sethex16t(regsrp,cpu->wdc_srp[0],cpu->wdc_srp[1]);
  189.                 break;
  190.             case AFF_68010|AFF_68020|AFF_68030|AFF_68040:
  191.             case AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060:
  192.                 sethex8t(regsrp,cpu->wdc_srp[0]);
  193.                 break;
  194.             }
  195.             if (regurp) sethex8t(regurp,cpu->wdc_urp);
  196.             if (regmmusr) sethex8t(regmmusr,cpu->wdc_mmusr);
  197.             if (regtt0) sethex8t(regtt0,cpu->wdc_tt0);
  198.             if (regtt1) sethex8t(regtt1,cpu->wdc_tt1);
  199.             if (regdtt0) sethex8t(regdtt0,cpu->wdc_dtt0);
  200.             if (regdtt1) sethex8t(regdtt1,cpu->wdc_dtt1);
  201.             if (regitt0) sethex8t(regitt0,cpu->wdc_itt0);
  202.             if (regitt1) sethex8t(regitt1,cpu->wdc_itt1);
  203.             DoMethod(win_cpu,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,app,2,MUIM_Application_ReturnID,MAIN_MORECPU);
  204.             set(win_cpu,MUIA_Window_Open,TRUE);
  205.         } else {
  206.             MUI_Request(app,win,0,NULL,"Ok","Couldn't open CPU window.");
  207.         }
  208.     }
  209. }
  210.  
  211. /****************************************************************************/
  212.  
  213.